<?php
/**
 * Created by HBuilder.
 * User: Ason
 * Date: 16-1-1
 * Time: 下午23:56
 */
?>
<div class="modal-dialog modal-lg">
	<div class="modal-content">

		<div class="modal-header bordered-bottom-3 bordered-orange">
			<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
					class="sr-only">Close</span></button>
			<h4 class="modal-title"><span class="fa fa-key"></span> 修改密码</h4>
		</div>
		<div class="modal-body">
			<!--错误提示 BEGIN-->
				<div id="edit_alert" class="alert text-center" style="display:none;"></div>
			<!--错误提示 END-->
			<form class="form">
				<div class="form-group clearfix form-bordered">
					<label class="control-label col-md-2">新密码</label>

					<div class="col-md-10">
						<div class="form-group">
							<input type="password" class="form-control" id="u_password" placeholder="请输入新的密码">
						</div>
					</div>
				</div>
				<div class="form-group clearfix form-bordered">
					<label class="control-label col-md-2">确认输入</label>

					<div class="col-md-10">
						<div class="form-group">
							<input type="password" class="form-control" id="u_password1" placeholder="请再次输入一遍新密码">
						</div>
					</div>
				</div>
			</form>

		</div>
		<div class="modal-footer">
			<div class="form-group text-right">
				<button class="btn btn-success" id="save">确认修改</button>&nbsp;&nbsp;&nbsp;&nbsp;
				<button class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>


	</div>
</div>
<script>
	$("#save").click(function(){
		$.post(
			"<?=site_url('user/do_change_pwd')?>",
			{
				password:$('#u_password').val().trim(),
				password1:$('#u_password1').val().trim()
			},
			function( json ){
				$( '#edit_alert' ).removeClass( 'alert-danger show').text('');
				data = eval( '(' + json + ')' );
				if( data.status == 'error' ){
					$('#edit_alert' ).addClass('alert-danger show').text( data.error );
				}else{
					$('#edit_alert' ).addClass('alert-success show').text( data.error );
					setTimeout( function(){
						window.location.reload();
					}, 2000);
				}
			}
		)
	});
</script>